'''

scores=[80,90,75,95]
print(scores)
print(type(scores))
my_list =['苹果',3.14,100,True]
print(my_list)
print(type(my_list))                #创建一个 列表，用中括号开表示  [ ]


fruits=['香蕉','苹果','橙子']
print(fruits[1])
print(fruits[2])
print(fruits[0])
print(fruits[3])           #IndexError: list index out of range

fruits=['香蕉','苹果','橙子']
if '苹果' in fruits:
    print('存在啊')

if '西瓜' not in fruits:
    print('不存在')

# append:添加元素，并将元素添加到最后一位
fruits = ["苹果","香蕉","橙子"]
fruits.append("葡萄")
print(fruits)

#insert (位置，东西)
fruits = ["苹果","香蕉","橙子"]
fruits.insert(1,'草莓')
print(fruits)

list=[1,2,3,4]
list1=[5,6,7,8]
list.extend(list1)
print(list)         #合并两个表


#删除最后一个pop
fruits = ["苹果","香蕉","橙子"]
fruits.pop()
print(fruits)

#删除指定的内容： remove
fruits = ["苹果","香蕉","橙子"]
fruits.remove("香蕉")
fruits.remove("葡萄")  # ValueError: list.remove(x): x not in list
print(fruits)

#clear，返回一个空的列表
fruits = ["苹果","香蕉","橙子"]
fruits.cear()
print(fruits)

# 通过索引进行删除
fruits = ["苹果","香蕉","橙子"]
del fruits[1]
print(fruits)
'''

# friends=['小明','小红']
# new_friends='小张'
# if new_friends not in friends:
#     friends.append('小张')
# print(friends)
# scores = [85, 92, 78, 96, 88]
# i=max(scores)
# print(i)
# words = ["hello", "", "world", "", "python"]
# new_words=[]
# for i in words:
#     if i != "":
#         new_words.append(i)
# print(new_words)
#

#列表
# numbers={2,3,4}
# new_numbers=1
# for i in numbers:
#     new_numbers *= i
# print(new_numbers)


# numbers = [1, 2, 3, 4, 5, 6]
# new_numbers =[]
# for i in numbers:
#     if i%2==0:
#         new_numbers.append(i)
# print(new_numbers)


# numbers = [10, 3, 7, 5, 8]
# i=max(numbers)
# print(i)


# numbers = [-1, 2, -3, 4, -5]
# new_numbers = []
# for i in numbers:
#     if i<0:
#         new_numbers.append(i)
# print(sum(new_numbers))


# numbers = [1, 2, 3, 4, 5]
# new_numbers = []
# for i in numbers:
#     i=i **2
#     new_numbers.append(i)
# new_numbers.extend(numbers)
# print(new_numbers)

# 1
# a={'安琪拉', '李白', '澜'}
# for i in a:
#     print(i)
#2
# a= {'镜', '露娜', '廉颇'}
# for index, i in enumerate(a, start=1):
#     print(f"{index}. {i}")
#3
# a = {'关羽', '夏洛特', '鲁班大师'}
# b = list(a)
# i = 0
# while i < len(b):
#     print(b[i])
#     i += 1

# #4
# hero_set = set()
# while True:
#     hero = input("请输入英雄名（输入'quit'结束）：")
#     if hero == 'quit':
#         break
#     hero_set.add(hero)
# print("去重后的英雄集合：", hero_set)
# #6
# heroes = ['孙尚香', '李白', '孙尚香', '镜', '澜']
# unique_heroes = set(heroes)
# count = 0
# for _ in unique_heroes:
#     count += 1
# print("不重复英雄数量（for循环统计）：", count)
# #7
# a = {'关羽', '夏洛特', '鲁班大师'}
# b = ['赵云', '关羽', '貂蝉']
# for i in a:
#     if i in b:
#         print(f"{i} 在列表中")
#     else:
#         print(f"{i} 不在列表中")
# #8
# numbers = {1, 2, 3, 4, 5, 6, 7, 8}
# new_numbers = numbers.copy()
# for num in new_numbers:
#     if num % 2 == 0:
#         numbers.remove(num)
# print( numbers)

# #9
# a = {'安琪拉', '李白', '澜', '镜'}
# b = {'镜', '关羽', '夏洛特'}
# print(a ^ b)
#11
# a = {'安琪拉', '李白', '澜', '镜'}
# b = {'镜', '关羽', '夏洛特'}
# c= a & b
# print("同时在两个集合中的英雄：")
# for i in c:
#     print(i)
# #12
# a = {'安琪拉', '李白', '澜', '镜'}
# b = {'镜', '关羽', '夏洛特'}
# new_a = a.copy()
# while new_a & b:
#     c = (new_a & b).pop()
#     new_a.remove(c)
# print(new_a)
# #13
# s = set()
# lists = [[1,2], [2,3], [3,4]]
# for i in lists:
#     s.update(i)
# print(s)
 #14
# sets = [{'A','B'}, {'B','C'}, {'C','D'}]
# result_union = set()
# for s in sets:
#     result_union = result_union.union(s)
# result_update = set()
# for s in sets:
#     result_update.update(s)
# print("使用union的结果：", result_union)
# print("使用update的结果：", result_update)

#15
# s1 = {1, 2}
# s2 = {2, 3}
# s3 = {3, 4}
# sets = [s1, s2, s3]
# result = sets[0]
# for i in sets[1:]:
#     result = result ^ s
# print("((s1 ^ s2) ^ s3) 的结果是：", result)

#16
# a={10,20,30}
# while a:
#     i=a.pop()
#     print("弹出元素",i)
# print("最终集合",a)

#17
# a = {'李白', '安琪拉', '镜', '澜'}
# b = {'镜', '关羽', '夏洛特', '露娜'}
# print(a - b)
# print(b - a)
# print(a & b)